package com.codedef.library.controller;

import com.codedef.library.service.QueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/query")
public class QueryController {

    @Autowired
    QueryService queryService;

    @PostMapping("/querySeatSection")
    public String querySeatSection(@RequestBody Map<String, String> reqMap) {
        Integer startSeat = Integer.parseInt(reqMap.get("startSeat"));
        Integer endSeat = Integer.parseInt(reqMap.get("endSeat"));
        String date = reqMap.get("date");
        String startTime = reqMap.get("startTime");
        String endTime = reqMap.get("endTime");
        Integer peopleNum = Integer.parseInt(reqMap.get("peopleNum"));

        String seatsStr = queryService.querySeatSection(startSeat, endSeat, date, startTime, endTime, peopleNum);
        System.out.println(seatsStr);


        return seatsStr;
    }

}
